package cn.ubeta.b2c.user;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import cn.ubeta.b2c.R;
import cn.ubeta.b2c.common.AnalyseActivity;
import cn.ubeta.b2c.user.order.OrderFragment;

/**
 * Created by denny on 16/9/5.
 */

public class OrderActivity extends AnalyseActivity {

    private OrderFragment mFragment;

    @Override
    public String getPageName() {
        return "订单列表页";
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState, R.layout.activity_order);
        
        //TitleBarHelper.setRightAction(this, "联系客服", v -> contactService());

        int type = getIntent().getIntExtra(OrderFragment.ARG_TYPE, 0);

        mFragment = OrderFragment.newInstance(type);
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.fl_fragment, mFragment)
                .commit();
    }

    /**
     * 跳转到订单
     * @param context
     * @param type
     */
    public static void gotoOrder(Context context, int type) {
        Bundle data = new Bundle();
        data.putInt(OrderFragment.ARG_TYPE, type);
        gotoActivityWithLogin(context, OrderActivity.class, data);
    }


    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        /*
        if (resultCode == Constant.PAY_RESPONSE_CODE) {
            if (processJdPayResult(data)) {
                mFragment.reload();
            }
        }
        */
    }
}
